VERSION 5.00
Begin VB.Form frmUserDB 
   BackColor       =   &H00000000&
   BorderStyle     =   1  'Fixed Single
   ClientHeight    =   4425
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   5880
   Icon            =   "frmUserDB.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4425
   ScaleWidth      =   5880
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton btnSaveAll 
      Caption         =   "Save all"
      Height          =   375
      Left            =   120
      TabIndex        =   13
      Top             =   3960
      Width           =   3735
   End
   Begin VB.CommandButton btnExitDB 
      Caption         =   "Exit Database"
      Height          =   375
      Left            =   3960
      TabIndex        =   12
      Top             =   3960
      Width           =   1815
   End
   Begin VB.ListBox DBList 
      BackColor       =   &H00000000&
      ForeColor       =   &H0000FF00&
      Height          =   2010
      Left            =   120
      TabIndex        =   11
      Top             =   360
      Width           =   5655
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H00000000&
      Caption         =   "Database Options"
      ForeColor       =   &H00FFFF00&
      Height          =   855
      Left            =   120
      TabIndex        =   6
      Top             =   3000
      Width           =   5655
      Begin VB.CommandButton btnEdit 
         Caption         =   "Save The Edited User"
         Height          =   315
         Left            =   1560
         TabIndex        =   9
         Top             =   360
         Width           =   2175
      End
      Begin VB.CommandButton btnDelete 
         Caption         =   "Delete Selected User"
         Height          =   315
         Left            =   3840
         TabIndex        =   8
         Top             =   360
         Width           =   1695
      End
      Begin VB.CommandButton btnAdd 
         Caption         =   "Add This User"
         Height          =   315
         Left            =   120
         TabIndex        =   7
         Top             =   360
         Width           =   1335
      End
   End
   Begin VB.TextBox txtDBRank 
      BackColor       =   &H00800000&
      ForeColor       =   &H00FFFFFF&
      Height          =   285
      Left            =   3960
      MaxLength       =   1
      TabIndex        =   5
      Top             =   2640
      Width           =   1815
   End
   Begin VB.TextBox txtDBAccess 
      BackColor       =   &H00800000&
      ForeColor       =   &H00FFFFFF&
      Height          =   285
      Left            =   2040
      MaxLength       =   3
      TabIndex        =   3
      Top             =   2640
      Width           =   1815
   End
   Begin VB.TextBox txtDBUser 
      BackColor       =   &H00800000&
      ForeColor       =   &H00FFFFFF&
      Height          =   285
      Left            =   120
      MaxLength       =   30
      TabIndex        =   1
      Top             =   2640
      Width           =   1815
   End
   Begin VB.Label Label5 
      BackColor       =   &H00000000&
      Caption         =   "(Select a User to Edit Them!)"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FFFF&
      Height          =   255
      Left            =   3240
      TabIndex        =   14
      Top             =   120
      Width           =   2535
   End
   Begin VB.Label Label1 
      BackColor       =   &H00000000&
      Caption         =   "Database Users:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FFFF&
      Height          =   255
      Left            =   120
      TabIndex        =   10
      Top             =   120
      Width           =   1455
   End
   Begin VB.Label Label4 
      BackColor       =   &H00000000&
      Caption         =   "User Rank:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FFFF&
      Height          =   255
      Left            =   3960
      TabIndex        =   4
      Top             =   2400
      Width           =   975
   End
   Begin VB.Label Label3 
      BackColor       =   &H00000000&
      Caption         =   "User Access:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FFFF&
      Height          =   255
      Left            =   2040
      TabIndex        =   2
      Top             =   2400
      Width           =   1215
   End
   Begin VB.Label Label2 
      BackColor       =   &H00000000&
      Caption         =   "Username:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FFFF&
      Height          =   255
      Left            =   120
      TabIndex        =   0
      Top             =   2400
      Width           =   975
   End
End
Attribute VB_Name = "frmUserDB"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim dbFSO As Object

Private Sub btnAdd_Click()

' Check if username is blank if it is then, give error and exit the add procedure
If txtDBUser.text = vbNullString Then
    MsgBox "Database Error: Enter the username of the user you wish to have access." & vbNewLine & "Why you got this: You did not enter a valid username, please click ok and try again!"
   Exit Sub
End If

' Write the user to the user.txt file and also adding them to the list box.
writeUser (txtDBUser.text & " " & txtDBAccess.text & " " & txtDBRank.text)
addString = txtDBUser.text & " " & txtDBAccess.text & " " & txtDBRank.text
DBList.AddItem addString

MsgBox "Added user!" & txtDBUser.text, , "VectorNet Bot v2.4"

txtDBUser.text = ""
txtDBAccess.text = ""
txtDBRank.text = ""

txtDBUser.SetFocus

End Sub

Private Sub btnDelete_Click()

  If DBList.List(DBList.ListIndex) = vbNullString Then Exit Sub
    DBList.RemoveItem (DBList.ListIndex)
    
    txtDBUser.text = ""
    txtDBAccess.text = ""
    txtDBRank.text = ""

End Sub

Private Sub btnEdit_Click()

  If txtDBRank.text = vbNullString Then
    DBList.List(DBList.ListIndex) = txtDBUser.text & " " & txtDBAccess.text
  ElseIf txtDBAccess.text = vbNullString Then
    DBList.List(DBList.ListIndex) = txtDBUser.text & " " & txtDBRank.text
  Else
    DBList.List(DBList.ListIndex) = txtDBUser.text & " " & txtDBAccess.text & " " & txtDBRank.text
  End If
  
  txtDBUser.text = ""
  txtDBAccess.text = ""
  txtDBRank.text = ""

End Sub

Private Sub btnExitDB_Click()

Unload Me

End Sub

Private Sub btnSaveAll_Click()

MsgBox "Your database settings have been saved!", , "VectorNet Bot - Database"

End Sub

Private Sub DBList_Click()

  getElement = DBList.List(DBList.ListIndex)
  
  If getElement <> vbNullString Then
    checkSpaces = Split(getElement)
    
    txtDBUser.text = checkSpaces(0)
    If UBound(checkSpaces) = 2 Then
      txtDBAccess.text = checkSpaces(1)
      txtDBRank.text = checkSpaces(2)
    Else
      If IsNumeric(checkSpaces(1)) Then
        txtDBAccess.text = checkSpaces(1)
      Else
        txtDBRank.text = checkSpaces(1)
      End If
    End If
  End If

End Sub

Private Sub Form_Load()

Set dbFSO = CreateObject("Scripting.FilesystemObject")

If dbFSO.FileExists(App.Path & "\" & "Users.txt") Then
  Set getUsers = dbFSO.GetFile(App.Path & "\" & "Users.txt").OpenAsTextStream(1)
  getArray = Split(getUsers.ReadAll, vbNewLine)
  For i = 0 To UBound(getArray) - 1
    DBList.AddItem getArray(i)
  Next
  getUsers.Close
End If

Me.Caption = "VectorNet Bot v2.4 | by Plugins -- User Database"

DBList.ForeColor = vbTeal

End Sub

Private Sub Form_Unload(Cancel As Integer)
If dbFSO.FileExists(App.Path & "\" & "Users.txt") Then
  Set writeUsers = dbFSO.GetFile(App.Path & "\" & "Users.txt").OpenAsTextStream(2)
  For i = 0 To DBList.ListCount - 1
    writeUsers.writeLine DBList.List(i)
  Next
  writeUsers.Close
End If

  Set dbFSO = Nothing
End Sub
